package com.movie.modules.api.controller;

import com.movie.common.utils.R;
import com.movie.modules.api.service.AppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author JF-PJJ
 */
@RestController
@Api(tags = "前台新闻接口")
@RequestMapping("/api")
public class ApiNewsController {
    @Autowired
    private AppService appService;

    @GetMapping("/news/list")
    @ApiOperation("新闻列表")
    public R newsList(Integer page){
        return R.ok().put("data",appService.newsList(page));
    }

    @GetMapping("/news/info/{newsId}")
    @ApiOperation("新闻详情")
    public R newsDetail(@PathVariable("newsId") Integer newsId){
        return R.ok().put("data",appService.newsDetail(newsId));
    }
}
